import {configureStore} from '@reduxjs/toolkit'
import counterReducer from './reducers/counter'
import shopcartReducer from './reducers/shopcart'
//configureStore来创建store
const store=configureStore({
    //reducer属性
    reducer:{
        //状态机的模块名:slice模块
        counter:counterReducer,
        shopcart:shopcartReducer
    }
})
export default store
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch